﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;


namespace JungleSurvivor
{
    class Enemy
    {
        public enum EnemyType { Normal, Strong, Fast, Boss }

        public float speed;
        public int health;
        public int animationFrame;
        public Vector2 position;
        public Texture2D texture1,texture2;
        public bool active = true;
        public Rectangle area;

        public Enemy(EnemyType type, ContentManager content)
        {

            switch (type)
            {
                case EnemyType.Normal:
                    {
                        speed = 1.5f;
                        health = 10;
                        texture1 = content.Load<Texture2D>("Graphics/normal");
                    }
                    break;
                case EnemyType.Strong:
                    {
                        speed = 1f;
                        health = 25;
                    }
                    break;
                case EnemyType.Fast:
                    {
                        speed = 2.5f;
                        health = 5;
                        texture1 = content.Load<Texture2D>("Graphics/fast");
                    }
                    break;
                case EnemyType.Boss:
                    {
                        speed = 0.75f;
                        health = 100;
                    }
                    break;
            }
        }

        public void UpdateMovement(GameTime gameTime)
        {
            if (health <= 0)
            {
                active = false;
                Resources.wood += 25;
            }
            
            if (position.X >= 1024) active = false;

            if (active == true)
            {
                position.X += speed;
                area.X = (int)position.X;
            }

        }

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(texture1, position, Color.White);
        }


    }
}
